package com.party.core.service.school.impl;

import com.google.common.base.Strings;
import com.party.common.paging.Page;
import com.party.core.dao.read.school.ScClassCTReadDao;
import com.party.core.dao.write.school.ScClassCTWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.school.ScClassCT;
import com.party.core.service.school.IScClassCTService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Set;

@Service
public class ScClassCTService implements IScClassCTService {
    @Autowired
    private ScClassCTReadDao classCTReadDao;

    @Autowired
    private ScClassCTWriteDao classCTWriteDao;

    @Override
    public String insert(ScClassCT scClassCT) {
        BaseModel.preInsert(scClassCT);
        if (classCTWriteDao.insert(scClassCT)) {
            return scClassCT.getId();
        }
        return null;
    }

    @Override
    public boolean update(ScClassCT scClassCT) {
        scClassCT.setUpdateDate(new Date());
        return classCTWriteDao.update(scClassCT);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        if (Strings.isNullOrEmpty(id)) {
            return false;
        }
        return classCTWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public ScClassCT get(String id) {
        if (Strings.isNullOrEmpty(id)) {
            return null;
        }
        return classCTReadDao.get(id);
    }

    @Override
    public List<ScClassCT> listPage(ScClassCT scClassCT, Page page) {
        return classCTReadDao.listPage(scClassCT, page);
    }

    @Override
    public List<ScClassCT> list(ScClassCT scClassCT) {
        return classCTReadDao.listPage(scClassCT, null);
    }

    @Override
    public List<ScClassCT> batchList(Set<String> ids, ScClassCT scClassCT, Page page) {
        return null;
    }
}
